<?php
/**
 * Dynamic room selection for sefault Template of RoomBooking View
 */
defined('_JEXEC') or die('Restricted access');
if (isset($_GET['organizationid']) and is_numeric($_GET['organizationid'])) {
  if (isset($_GET['requestItems']) and $_GET['requestItems']==='building') {
     $id_organization = intval($_GET['organizationid']);
	$buildings=$this->getBuildings($id_organization);
	$returnBuildings="";
     foreach ($buildings as $building){
     	if($building->we_opening)
     		$building->we_opening=JText::_( 'Yes' );
     	else
     		$building->we_opening=JText::_( 'No' );
		 $returnBuildings .= "||".$building->id."**".$building->name."**".$building->address."**".$building->opening."**".$building->closing."**".$building->we_opening;
     }
      print_r("##Start-buildings##".$returnBuildings."##End-buildings##");
  } 
} 
elseif  (isset($_GET['buildingid']) and is_numeric($_GET['buildingid'])) {
	if (isset($_GET['requestItems']) and $_GET['requestItems']==='room') {
	$id_building = intval($_GET['buildingid']);
	$rooms=$this->getRooms($id_building);
	$returnRooms="";
     foreach ($rooms as $room){
		 $returnRooms .= "||".$room->id."**".$room->name."**".$room->num_seats."**".$room->floor."**".$room->cost;
     }
      print_r("##Start-rooms##".$returnRooms."##End-rooms##");
  } 
} 
?>